package com.cff.shorturl.task;

import java.util.Date;

import com.cff.shorturl.db.DbFactory;
import com.cff.shorturl.db.DbManager;
import com.cff.shorturl.util.DateUtil;

public class LimitLogTask extends CallbackTask {
	String appId;
	Date date;
	String action;
	boolean update = false;

	@Override
	public void doTask() throws Exception {
		logger.info("执行任务开始。");
		DbManager db = DbFactory.createDbManager();
		String insql = "insert into t_short_log(appId,date,time,action) values (?,?,?,?)";
		if (update) {
			// insql = "update t_short_log set date = ? where appId = ?";
		}
		db.execute(insql, appId, DateUtil.format(date, DateUtil.SimpleDatePattern),
				DateUtil.format(date, DateUtil.SimpleTimePattern), action);
	}

	public String getAppId() {
		return appId;
	}

	public void setAppId(String appId) {
		this.appId = appId;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getAction() {
		return action;
	}

	public void setAction(String action) {
		this.action = action;
	}

	public boolean isUpdate() {
		return update;
	}

	public void setUpdate(boolean update) {
		this.update = update;
	}

}
